<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Core</title>
		<script src="../../py/system.js" type="text/javascript"></script>
		<script src="../../py/hust/string.js" type="text/javascript"></script>
		<script src="../assets/scripts/debug.js" type="text/javascript"></script>

	</head>
	<body>
		<script>
			var fns = [
				["测试的名字， 看看的", function(){  /* 真正执行的函数*/return Object.type(1); }, /*预期的返回值， 可以不写*/'number']
			];
		</script>
	<div id="tpl">
		 <h2><%=  name %></h2>
                <%# 这是注释!!!!!!!!! %>
                <ul>
                <% for(var i=0; i< supplies.length; i++){ %>
				  <%  if (i>0){%>
                    <li><%=  supplies[i] %></li>
					<li><%=  i %></li>
					 <% } %>
                  <% } %>
                </ul>
                <% var color = "color:red;" %>
                <p style="text-indent:2em;<%= color %>"><%= address %></p>
		
		
	</div>
	解析后的文本
	<div id="tpltext">
	</div>	
	<script>
		var a=2,b=1,c=4,d=2,obj=document.getElementById('tpl');
		var tplcontent=obj.innerHTML.replace(/\n|\t/g,''),
		    left="{{",right="}}",vars=[];
		
		//tplcontent=parseElseIf(tplcontent);
		//alert('{"a":"123","b":"345","c":{"d":"678","e":345}}'.toObject().a);
		function parseIf(tplcontent){
			return tplcontent.replace(new RegExp(left+'(.*)'+right+'\s*(.*)'+left+'\s*/if'+right),function(){
				     return arguments[1]+"{vars.push('"+arguments[2]+"')}";
		            }
		           ).replace(/\\n|\\t/g,'');	
		}
		function parseElseIf(tplcontent){
			tplcontent=tplcontent.split(/(?={{if)/);
			var temp=[];
			for(var i=0,len=tplcontent.length;i<len;i++){
				temp.push(tplcontent[i].replace(new RegExp(right+'(.*?)'+left,'g'),function(){
					 return "{vars.push('"+arguments[1]+"')}";
		            }
		           ).replace(/\{\{(.*)\/if\}\}/,'$1'));
			}
			return temp.join('');
		}
		//alert("\t\n123good");
		var a=[50.82,50.83,50.87,50.89],
		   a1=[50.78,50.78,50.75,50.85,50.82,50.81];
		Math.sum=function(){
			var sum=0;
			for(var i=0,l=arguments.length;i<l;i++){
				sum+=arguments[i];
			}
			return sum;
		}
		//alert(Math.sum.apply(this,a)/a.length);
		var x=50.80;
	    var b=[];
		a1.forEach(function(v,k){
			b.push(Math.pow(x-v,2))
			//Math.abs(v-x)>0.038014&&trace(v+":"+k);
			//trace(v-x);
			//b.push(v-x);
		});
		//alert(Math.sum.apply(this,a)/a.length+"\n"+Math.sum.apply(this,a1)/a1.length);
		var y=Math.sum.apply(this,b);
		var c=Math.sqrt(y);
		//alert(y);
		alert(Math.sqrt(10*(0.0033+0.0063)/(24*8)))
        //document.getElementById("tpltext").innerHTML=new Function(tplcontent+"   return vars.join('')")();
	</script>
	</body>
</html>